<?php
if(!isset($_SESSION['user'])){
redirect(LOGIN);
}

if($_GET['act']=='upload'){
	
	$data1['title']="BONGDAVL";
	loadview('template/header_admin',$data1);
	loadview('user/upload_step',$data);
	loadview('template/footer_admin',$data);
	exit();
}

if($_GET['act']=='post_truyen'){
	
	$data1['title']="Đăng Chương Truyện";
	loadview('template/header_admin',$data1);
	loadview('user/post_truyen',$data);
	loadview('template/footer_admin',$data);
	exit();
}

if($_GET['act']=='post_image'){
		$model = new Model();
		$model->select = "id, name";
		$model->where = "username = '" . $_SESSION['user']['username'] . "' or public=1";
		$model->order = "name ASC";
		$model->getdata('album');
		$data['albums'] = $model->fetchAll();
		
		$model->select = "id, name, p_id";
		$model->where = "image_type = 1";
		$model->order = "thutu ASC";
		$model->getdata('category');
		$resultArr = $model->fetchAll();
		
		recursive($resultArr, 0 , 1, $data['categories']);
		
		loadview('template/header_admin',$data);
		loadview('user/post_image',$data);
		loadview('template/footer_admin',$data);
		exit();

}

if($_GET['act']=='post_text'){
		$model = new Model();
		
		$model->select = "id, name";
		$model->order = "name ASC";
		$model->where = "username = '" . $_SESSION['user']['username'] . "' or public-1";
		$model->getdata('album');
		$data['albums'] = $model->fetchAll();
		
		$model->select = "id, name, p_id";
		$model->where = "text_type = 1";
		$model->order = "thutu ASC";
		$model->getdata('category');
		$resultArr = $model->fetchAll();
		
		recursive($resultArr, 0 , 1, $data['categories']);
		
		
		
		loadview('template/header_admin',$data);
		loadview('user/post_text',$data);
		loadview('template/footer_admin',$data);
		exit();
}

if($_GET['act']=='post_video'){

		$model = new Model();

		$model->select = "id, name";
		$model->order = "name ASC";
		$model->where = "username = '" . $_SESSION['user']['username'] . "' or public=1";
		$model->getdata('album');
		$data['albums'] = $model->fetchAll();
		
		$model->select = "id, name, p_id";
		$model->where = "video_type = 1";
		$model->order = "thutu ASC";
		$model->getdata('category');
		$resultArr = $model->fetchAll();
		
		recursive($resultArr, 0 , 1, $data['categories']);
		
		
		loadview('template/header_admin',$data);
		loadview('user/post_video',$data);
		loadview('template/footer_admin',$data);
		exit();
}


?>
